Tidy Tuesday assignment #8 on digital publications from 2022-04-05 data.
library(tidyverse)
library(here)
library(rcartocolor)
library(showtext)
library(ggplot2)
library(dplyr)
library(patchwork)
library(gganimate)
news_data <- read_csv(here("Tidy_Tuesday_8/data","news_orgs.csv"))
glimpse(news_data)
## Rows: 741
## Columns: 40
## $ publication_name <chr> "1808Delaware", "1812Blo…
## $ parent_publication <chr> "Total|Local Media", "To…
## $ url <chr> "https://1808delaware.co…
## $ owner <chr> "Thomas Palmer", "Thomas…
## $ is_owner_founder <chr> "Yes", "Yes", "No", "No"…
## $ city <chr> "Mansfield", "Mansfield"…
## $ state <chr> "OH", "OH", "OH", "MO", …
## $ country <chr> "United States", "United…
## $ primary_language <chr> "English", "English", "E…
## $ primary_language_other <lgl> NA, NA, NA, NA, NA, NA, …
## $ tax_status_founded <chr> "Sole Proprietor/no spec…
## $ tax_status_current <chr> "Sole Proprietor/no spec…
## $ year_founded <dbl> 2018, 2016, 2010, 2013, …
## $ total_employees <chr> "0", "0", NA, NA, "21 or…
## $ budget_percent_editorial <chr> "11-20", "11-20", NA, NA…
## $ budget_percent_revenue_generation <chr> "0-10", "0-10", NA, NA, …
## $ budget_percent_product_technology <chr> "11-20", "11-20", NA, NA…
## $ budget_percent_administration <chr> "71-80", "71-80", NA, NA…
## $ products <chr> NA, NA, NA, NA, "News ag…
## $ products_other <chr> NA, NA, NA, NA, NA, NA, …
## $ distribution <chr> NA, NA, NA, NA, "Email, …
## $ distribution_method_other <chr> NA, NA, NA, NA, NA, NA, …
## $ geographic_area <chr> NA, NA, NA, NA, "City/To…
## $ core_editorial_strategy_characteristics <chr> NA, NA, NA, NA, "Curatio…
## $ core_editorial_strategy_characteristics_other <chr> NA, NA, NA, NA, NA, NA, …
## $ coverage_topics <chr> NA, NA, NA, NA, "Events …
## $ coverage_topics_other <lgl> NA, NA, NA, NA, NA, NA, …
## $ underrepresented_communities <chr> NA, NA, NA, NA, "Communi…
## $ underrepresented_communities_not_listed <chr> NA, NA, NA, NA, NA, NA, …
## $ revenue_streams <chr> NA, NA, NA, NA, "Direct …
## $ revenue_stream_other <lgl> NA, NA, NA, NA, NA, NA, …
## $ revenue_stream_additional_info <lgl> NA, NA, NA, NA, NA, NA, …
## $ revenue_stream_largest <chr> NA, NA, NA, NA, "Direct …
## $ revenue_streams_largest_other <chr> NA, NA, NA, NA, NA, NA, …
## $ paywall_or_gateway <chr> NA, NA, NA, NA, "I don't…
## $ paywall_or_gateway_other <lgl> NA, NA, NA, NA, NA, NA, …
## $ advertising_products <chr> NA, NA, NA, NA, "Branded…
## $ advertising_product_other <lgl> NA, NA, NA, NA, NA, NA, …
## $ real_world_impacts <chr> NA, NA, NA, NA, "6AM Cit…
## $ summary <chr> NA, "You are looking at …
view(news_data)
news <- news_data %>%
select(publication_name, city, state, country, year_founded, summary) %>%
filter(state %in% c("CA","NY"))
view(news)
ca_news <- news %>%
select(publication_name, city, state, country, year_founded, summary) %>%
filter(state == "CA") %>%
top_n(publication_name, n = 10)
glimpse(ca_news)
## Rows: 10
## Columns: 6
## $ publication_name <chr> "The South Pasadenan", "Times of San Diego", "Voice o…
## $ city <chr> "South Pasadena", "San Diego", "Santa Ana", "San Dieg…
## $ state <chr> "CA", "CA", "CA", "CA", "CA", "CA", "CA", "CA", "CA",…
## $ country <chr> "United States", "United States", "United States", "U…
## $ year_founded <dbl> 2017, 2014, 2009, 2005, 2005, 2018, 2016, 2012, 2007,…
## $ summary <chr> "SouthPasadenan.com delivers hyper-local news, events…
ny_news <- news %>%
select(publication_name, city, state, country, year_founded, summary) %>%
filter(state == "NY") %>%
top_n(publication_name, n = 10)
glimpse(ny_news)
## Rows: 10
## Columns: 6
## $ publication_name <chr> "The Highlands Current", "The Ithaca Voice", "The Lar…
## $ city <chr> "Cold Spring", "Ithica", "Westchester", "Lower East S…
## $ state <chr> "NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY",…
## $ country <chr> "United States", "United States", "United States", "U…
## $ year_founded <dbl> 2010, 2014, 2007, 2009, 2009, 2017, 2010, 2015, 2010,…
## $ summary <chr> "Highlands Current Inc. is a New York State not-for-p…
CA <- ca_news %>%
ggplot(aes(x = year_founded,
y = city,
color = publication_name))+
geom_point(size = 5)+
transition_states(
year_founded, # what are we animating by
transition_length = 2, #The relative length of the transition.
state_length = 1 # The length of the pause between transitions
)+
ease_aes("bounce-in-out")+
ggtitle('Year: {closest_state}')+ #title changes with animation
labs(x = "Year", #x axis
y = "City", #y axis
fill = "Publication Name")+ #fills points
theme_bw()+
scale_color_carto_d(name = "Publication Name:", palette = "Pastel") #adds color to fill
CA
CA <- ca_news %>%
ggplot(aes(x = year_founded,
y = city,
color = publication_name))+
geom_point(size = 5)+
labs(x = "Year", #x axis
y = "City", #y axis
fill = "Publication Name")+ #fills points
theme_bw()+
scale_color_carto_d(name = "Publication Name:", palette = "Pastel") #adds color to fill
CA